package com.xn.app.muying.adpter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;

import com.xn.app.muying.R;

import java.util.ArrayList;

/**
 * Created by Administrator on 2016/10/10.
 */
public class HomeItemAdpter extends BaseAdapter{

    private Context context;
    private ArrayList<String> list;
    private LayoutInflater inflater;

    public HomeItemAdpter(Context context, ArrayList<String> list){
        this.context = context;
        this.list = list;
        inflater = LayoutInflater.from(context);
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View view, ViewGroup viewGroup) {
        ViewHolderItem holderItem = new ViewHolderItem();

        view = inflater.inflate(R.layout.home_fragment_floor_item,null);
        holderItem.imageView =(ImageView)view.findViewById(R.id.imageView);
        holderItem.textView =(TextView) view.findViewById(R.id.xuanchuan_listview_textView);
        holderItem.listView =(ListView) view.findViewById(R.id.xuanchuan_listView);

        ItemInfoAdpter homeAdapterr =  new ItemInfoAdpter(context,list);
        holderItem.listView.setAdapter(homeAdapterr);

        return view;
    }

    class ViewHolderItem{
        ImageView imageView;
        TextView textView;
        ListView listView;
    }
}
